/**
 * 
 */
package edu.serg.mbar.ucon.interfaces;

import org.w3c.dom.Node;

/**
 * This interface must be implemented by any class which provides 
 * the functionality of Parsing and Evaluating UCON Policy. 
 * 
 * @author Sanaullah
 *
 */
public interface PolicyEvaluator {
	
	/**
	 * This function will implement the functionality of evaluating the UCON policy
	 * 
	 * @param subject
	 * 		The ID of the Subject which has requested or is exercising a right on an object.
	 * @param object
	 * 		The ID of the Object which has been requested or is being accessed by the Subject.
	 * @param right
	 * 		The right which has been requested or is being exercised(if already granted) by the Subject on the Object.
	 * @param policyType
	 * 		The Type of policy (e.g. "PermitAccess", "PreUpdateOnRequest", "Onupdate", "PostUpdate", "RevokeAccess", "EndAccess")
	 * @return
	 * 		Returns True or False indicating whether the condition specified in the policy are being met or not.
	 */
	public boolean evaluatePolicy(String subject, String object, String right, String policyType);
	
	/**
	 * This function when implemented will provide the functionality of processing the Condition element/node in the UCON policy.
	 * 
	 * @param conditionNode
	 * 		The DOM Node representation of the condition node in the UCON policy document.
	 * @param subject
	 * 		The ID of the Subject which is requesting or accessing the Object.
	 * @param object
	 * 		The ID of the Object which has been requested or is being accessed by the subject.
	 * @param right
	 * 		The right that has been requested or is being exercised by the subject on the object.
	 * @return
	 * 		returns True or False based on whether the predicates specified in the condition Node of the policy are being  
	 */
	public boolean evaluateCondition(Node conditionNode, String subject, String object, String right);

}
